<?php
	require 'init.inc.php';
	
	$smarty->caching=0;
	$user=new User();
	
	if($_GET["action"]=="login"){
		if($user->login($_POST["username"], $_POST['password'])){
			$smarty->assign("infotitle","恭喜！用户<b>".$_POST["username"]."<b>登录成功");
			$smarty->assign("jump",true);
		}else{
			$smarty->assign("infotitle", "对不起! 用户<b>".$_POST["username"]."</b>登录失败");
			$smarty->assign("jump",false);
		}
		$smarty->assign("url",$_POST['url']);
	}elseif($_GET['action']=="logout"){
		$user->logout();
		$smarty->assign("infotitle","你已经成功退出本站登陆");
		$smarty->assign("url",APP_PATH);
	}
	
	$smarty->assign("appName",APP_NAME);
	$smarty->assign("stylePath",STYLE_PATH.APP_STYLE);
	$smarty->display(APP_STYLE."/message.html");
	
?>